<!--品牌列表-->
<template>

	<div id="brandSearchList" class="container-fluid">

		
	<div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title">查询条件</h3>
      </div>
      <div class="panel-body">
				 <el-form inline="true" model="formInline" class="demo-form-inline">

				  <el-form-item label="名称">
				    <el-input  placeholder="名称" v-model="form.brandName"></el-input>
				  </el-form-item>
				 
         
          <el-form-item class="center">
				  
            <el-button type="primary" @click="onSubmit">查询</el-button>
            <router-link :to="{ path: 'brandAdd' }">
               <el-button type="info">添加</el-button>
            </router-link>

				  </el-form-item>
         

				</el-form>
      </div>
    </div>


    <div class="panel panel-success">
      <div class="panel-heading">
        <h3 class="panel-title">查询结果</h3>
      </div>
      <div class="panel-body">
     			

     		<table class="table table-striped table table-bordered table-condensed">
				
			 	<thead>
			 		<tr>
			 			<th>名称</th>
			 			<th>英文名称</th>
			 			<th>图片</th>
			 			<th>是否在品牌专区显示</th>
			 			<th>录入时间</th>
			 			<th>操作</th>
			 		</tr>
			 	</thead>

			 	<tbody>
			 	 
            <tr v-for="brand in dataList">

                <td>
                    {{brand.brandName}}
                </td>
                
                <td>
                    {{brand.brandNameEn}}
                </td>

          
                <td>
                   <img  v-if="!!brand.fileUrl" :src="brand.fileUrl" />
                </td>

                <td>
                   <span v-if="brand.isShowInZone">是</span>
                   <span v-if="!brand.isShowInZone">否</span>
                </td>

                <td>
                    {{brand.inputOn}}
                </td>
                <td>  
                    <el-button icon="edit" type="info" @click="editBrand(brand.id)" >编辑</el-button>
                </td> 
            </tr>

			 	</tbody>

			

      </table>



       <div class="block">
       
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="this.form.pageNum"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="form.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="page.totalSize">
        </el-pagination>
      </div>
      </div>
    </div>
	</div>

		
</template>

<script>
  import axios from 'axios'
  export default{
  	data () {
  		return {
            dataList: [],
            form:{
            brandName:'',
            pageNum: 1,
            pageSize: 10,
            startTime:'',
            endTime:'',
          },
          page:{
            totalSize: 0,
            totalPage: ''
          },
  		}
  	},
    mounted(){
      this.searchList();
    },
  	methods: {
  		searchList (){
         let apiurl="/brand/getBrandListByPage";
        if(!!this.form.brandName)
         apiurl="/brand/getBrandListByName";
  			axios.post("/api"+apiurl,this.form).then((res) => {
          this.dataList=res.data.data.brandList;
          this.page.totalSize=res.data.data.total;
  			});
  		},
         //查询按钮
      onSubmit (){
        this.searchList();
      },
      //分页
      handleCurrentChange(pageNum){
        this.form.pageNum=pageNum;
        this.searchList();
      },
      //页码
      handleSizeChange(pageSize){
        this.form.pageSize=pageSize;
        this.searchList();
      },
      //编辑
      editBrand(id){
       this.$router.push({ name: 'brandEdit', params: { id: id }})
      },

  	}
  }
	
</script>

<style lang="less" scoped>

<style>


